<template>
    <el-form ref="ruleFormRef" label-position="top" :model="importForm" :rules="formRules" label-width="auto"
        v-loading="isLoading">
        <el-row :gutter="30">
            <re-col :value='24' :xs='24' :sm='24'>
                <el-form-item prop='file'>
                    <el-upload class="upload-demo" drag action="" :auto-upload="false" multiple :limit="1"
                        :style="{ width: '100%' }" :on-change="handleChange" v-model:file-list="uploadFiles">
                        <el-icon class="el-icon--upload"><upload-filled /></el-icon>
                        <div class="el-upload__text">
                            拖拽文件或者<em>点击文件</em>上传
                        </div>
                        <template #tip>
                            <div class="el-upload__tip">
                                <!-- jpg/png files with a size less than 500kb -->
                            </div>
                        </template>
                    </el-upload>
                </el-form-item>
            </re-col>
           
        </el-row>
    </el-form>
</template>
<script lang="ts" setup>
import { UploadFilled } from '@element-plus/icons-vue';
import ReCol from "@/components/ReCol";
const ruleFormRef = ref();
type FormProps = {
    importForm: any,
    isLoading: false
}
const props = withDefaults(defineProps<FormProps>(), {
    importForm: {
        file: null,
        operator: null,
        canal: null,
    },
    isLoading: false
});
const formRules = reactive(<FormRules>{
    file: [{ required: true, message: "请上传文件", trigger: 'blur' },],
});
const uploadFiles = ref<any>([])
const handleChange = (uploadFile, uploadFiles) => {
    props.importForm.file = uploadFile.raw
}






function getRef() {
    return ruleFormRef.value;
}

defineExpose({ getRef });
</script>
<style lang="scss" scoped></style>
